<include file="public@header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Goods/index')}">商品列表</a></li>
        <li class="active"><a href="{:url('Goods/edit')}">商品修改</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Goods/editPost')}">
        <div class="form-group">
            <label for="input-title" class="col-sm-2 control-label">商品名称<span class="form-required"></span></label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-title" name="name" value="{$res.name}">
            </div>
        </div>
        <div class="form-group">
            <label for="input-image" class="col-sm-2 control-label">商品图片</label>
            <div class="col-md-6 col-sm-10">
                <input id="photo-1" type="hidden" name="image" value="{$res.image}">
                <input id="photo-1-name" type="text"  title="图片名称" value="{$res.image}" readonly disabled>
                <img id="input-image" style="width: 50px" >
                <a href="javascript:uploadOneImage('图片上传','#photo-1');" class="btn-primary btn">上传</a>
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">图集</label>
            <div class="col-md-6 col-sm-10">
                <div id="imagesContainer"></div>
                <div class="margin-top-20"></div>
                <div class="margin-top-10">
                    <a class="btn btn-default" href="javascript:uploadMultiImage('图片上传','#imagesContainer','photos-item-wrapper');">选择图片</a>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="input-number" class="col-sm-2 control-label">运费<span class="form-required"></span></label>
            <div class="col-md-6 col-sm-10">
                <input type="number" class="form-control" id="input-number" name="freight" value="{$res.freight}">
            </div>
        </div>
        <div class="form-group">
            <label for="input-zy" class="col-sm-2 control-label">是否自营<span class="form-required"></span></label>
            <div class="col-md-6 col-sm-10">
                <select name="zy" id="input-zy" class="form-control">
                    <option value="0" <if($res.zy == 0)>selected</if> >不自营</option>
                    <option value="1" <if($res.zy == 1)>selected</if> >自营</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="input-show" class="col-sm-2 control-label">是否展示<span class="form-required"></span></label>
            <div class="col-md-6 col-sm-10">
                <select name="status" id="input-show" class="form-control">
                    <option value="0" <if($res.status == 0)>selected</if> >不展示 </option>
                    <option value="1" <if($res.status == 1)>selected</if> >展示 </option>
                    <option value="2" <if($res.status == 2)>selected</if> >缺货 </option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
                <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
            </div>
        </div>
    <input type="hidden" name="id" value="{$res.id}">
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    var editorcontent = new baidu.editor.ui.Editor();
    editorcontent.render('content');
</script>
//多图片上传
<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
<script type="text/html" id="photos-item-wrapper">
    <div style="display: flex;align-items:center;border:1px solid #ddd;padding: 5px;margin-top:10px;  ">
        <div><img id="photo-{id}-preview" src="{url}" class="img-thumbnail" style="width: 100px;height: 50px;"></div>
        <div style="margin-left:10px; ">{name}</div>
        <input type="hidden" id="photo-{id}" name="image[]" value="{filepath}">
    </div>
</script>
</body>
</html>